package com.fms.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fms.entity.SysUser;
import com.fms.vo.UserInfoVO;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


public interface SysUserMapper extends BaseMapper<SysUser> {
    @Select("SELECT count(*) FROM sys_user WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) < DATE(create_date);")
    Integer getNewUserCount();

    @Select("select username,real_name,img_url,gender,status,show_id,name as deptName from sys_user left join sys_dept on dept_id=sys_dept.id where username=#{username}")
    UserInfoVO getUserInfoByUsername(String username);

    @Update("UPDATE sys_user SET img_url = #{imgUrl} WHERE username = #{username}")
    void updateImg(String username, String imgUrl);
}
